package com.wangyadong.hobby.metric.jvmmoudle;

import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
import com.codahale.metrics.jvm.ThreadStatesGaugeSet;

import java.io.Console;
import java.util.concurrent.TimeUnit;

/**
 * <p>
 *
 * @author <714037465@qq.com>
 * @since 2018/12/1914:57
 **/
public class GarbageCollectorMetricsSetExample {
    private static final MetricRegistry registry = new MetricRegistry();
    private static final ConsoleReporter report = ConsoleReporter
            .forRegistry(registry)
            .build();

    public static void main(String[] args) throws InterruptedException {
        report.start(0, 10, TimeUnit.SECONDS);
        final GarbageCollectorMetricSet garbageCollectorMetricSet = new GarbageCollectorMetricSet();
        registry.registerAll(garbageCollectorMetricSet);
        registry.registerAll(new ThreadStatesGaugeSet());
        Thread.currentThread().join();
    }
}
